<!-- my profile account fields -->

{foreach from=$profile_info.Fields item='field'}
	{assign var='fKey' value=$field.Key}
	{assign var='fVal' value=$smarty.post.account}
	
	<tr>
		<td class="name">
			{if $field.Required}
				<span class="red">*</span>
			{/if}
			
			{$field.name}
		</td>
		<td class="field" id="sf_field_{$field.Key}">
			{if $field.Type == 'text'}
				<input type="text" name="account[{$field.Key}]" maxlength="{if $field.Values != ''}{$field.Values}{else}255{/if}" value="{if $fVal.$fKey}{$fVal.$fKey}{elseif $field.Default}{$field.default}{/if}" />
			{elseif $field.Type == 'textarea'}
				<textarea rows="4" cols="" name="account[{$field.Key}]" id="textarea_{$field.Key}">{if $fVal.$fKey}{$fVal.$fKey}{elseif $field.Default}{$field.default}{/if}</textarea>
				<script type="text/javascript">
				{literal}
				
				$(document).ready(function(){
					$('#textarea_{/literal}{$field.Key}{literal}').textareaCount({
						'maxCharacterSize': {/literal}{$field.Values}{literal},
						'warningNumber': 20
					})
				});
				
				{/literal}
				</script>
			{elseif $field.Type == 'number'}
				<input class="numeric w120" type="text" name="account[{$field.Key}]" size="{if $field.Values}{$field.Values|count_characters}{else}10{/if}" maxlength="{if $field.Values}{$field.Values|count_characters}{else}10{/if}" {if $fVal.$fKey}value="{$fVal.$fKey}"{elseif $field.Default}value="{$field.default}"{/if} />
			{elseif $field.Type == 'date'}
				{if $field.Default == 'single'}
					<input type="text" id="date_{$field.Key}" name="account[{$field.Key}]" maxlength="10" style="width: 70px;float: {$text_dir};" value="{$fVal.$fKey}" />
					<div class="clear"></div>
					<script type="text/javascript">
					{literal}
					$(document).ready(function(){
						$('#date_{/literal}{$field.Key}{literal}').datepicker({showOn: 'button', buttonImage: '{/literal}{$rlTplBase}{literal}img/calendar.gif', buttonImageOnly: true, dateFormat: 'yy-mm-dd'}).datepicker($.datepicker.regional['{/literal}{$smarty.const.RL_LANG_CODE}{literal}']).css('border-{/literal}{$text_dir_rev}{literal}', 0);
					});
					{/literal}
					</script>
				{elseif $field.Default == 'multi'}
					<table>
					<tr>
						<td><label for="date_{$field.Key}_from" class="fLable">{$lang.from}</label></td>
						<td style="width: 120px;"><input class="text" type="text" id="date_{$field.Key}_from" name="account[{$field.Key}][from]" maxlength="10" style="width: 70px;float: {$text_dir};" value="{$fVal.$fKey.from}" /></td>
						<td><label for="date_{$field.Key}_to" class="fLable">{$lang.to}</label></td>
						<td style="width: 120px;"><input class="text" type="text" id="date_{$field.Key}_to" name="account[{$field.Key}][to]" maxlength="10" style="width: 70px;float: {$text_dir};" value="{$fVal.$fKey.to}" /></td>
					</tr>
					</table> 
					<script type="text/javascript">
					{literal}
					$(document).ready(function(){
						$('#date_{/literal}{$field.Key}{literal}_from').datepicker({showOn: 'button', buttonImage: '{/literal}{$rlTplBase}{literal}img/calendar.gif', buttonImageOnly: true, dateFormat: 'yy-mm-dd'}).datepicker($.datepicker.regional['{/literal}{$smarty.const.RL_LANG_CODE}{literal}']).css('border-{/literal}{$text_dir_rev}{literal}', 0);
						$('#date_{/literal}{$field.Key}{literal}_to').datepicker({showOn: 'button', buttonImage: '{/literal}{$rlTplBase}{literal}img/calendar.gif', buttonImageOnly: true, dateFormat: 'yy-mm-dd'}).datepicker($.datepicker.regional['{/literal}{$smarty.const.RL_LANG_CODE}{literal}']).css('border-{/literal}{$text_dir_rev}{literal}', 0);
					});
					{/literal}
					</script>
				{/if}
			{elseif $field.Type == 'mixed'}
				<input class="numeric" type="text" name="account[{$field.Key}][value]" size="8" maxlength="15" {if $fVal.$fKey.value}value="{$fVal.$fKey.value}"{/if} />
				{if !empty($field.Condition)}
					{assign var='df_condition' value=$field.Condition}
					{assign var='df_source' value=$df.$df_condition}
				{else}
					{assign var='df_source' value=$field.Values}
				{/if}
		
				{if $df_source|@count > 1}
					<select name="account[{$field.Key}][df]">
						{foreach from=$df_source item='df_item' key='df_key'}
							<option value="{$df_item.Key}" {if $fVal.$fKey.df}{if $df_item.Key == $fVal.$fKey.df}selected="selected"{/if}{else}{if $df_key == $field.Default}selected="selected"{/if}{/if}>{$field.Default}{$df_item.name}</option>
						{/foreach}
					</select>
				{else}
					<input type="hidden" name="f[{$field.Key}][df]" value="{foreach from=$df_source item='df_item'}{$df_item.Key}{/foreach}" />
					<span class="fLable" style="font-size: 12px;">{foreach from=$df_source item='df_item'}{$df_item.name}{/foreach}</span>
				{/if}
			{elseif $field.Type == 'unit'}
				<input class="numeric w80" type="text" name="account[{$field.Key}][value]" size="8" maxlength="15" {if $fVal.$fKey.value}value="{$fVal.$fKey.value}"{/if} />
				{if $df.unit|@count > 1}
				<select name="account[{$field.Key}][unit]" style="width: 60px;">
					{foreach from=$df.unit item='unit_item'}
						<option value="{$unit_item.Key}" {if $unit_item.Key == $fVal.$fKey.unit}selected="selected"{/if}>{$unit_item.name}</option>
					{/foreach}
				</select>
				{else}
					<input type="hidden" name="account[{$field.Key}][unit]" value="{$df.unit.0.Key}" />
					<span class="fLable" style="font-size: 12px;">{$df.unit.0.name}</span>
				{/if}
			{elseif $field.Type == 'bool'}
				<input id="{$field.Key}_1" type="radio" value="on" name="account[{$field.Key}]" {if $fVal.$fKey == 'on'}checked{elseif $field.Default}checked{/if} /> <label for="{$field.Key}_1" class="fLable">{$lang.yes}</label>
				<input id="{$field.Key}_0" type="radio" value="off" name="account[{$field.Key}]" {if $fVal.$fKey == 'off'}checked{elseif !$field.Default}checked{/if} /> <label for="{$field.Key}_0" class="fLable">{$lang.no}</label>
			{elseif $field.Type == 'select'}
				<select name="account[{$field.Key}]">
					<option value="0">{$lang.select}</option>
		
					{foreach from=$field.Values item='option' key='key'}
						{if $field.Condition}
							{assign var='key' value=$option.Key}
						{/if}
						<option value="{if $field.Condition}{$option.Key}{else}{$key}{/if}" {if $fVal.$fKey}{if $fVal.$fKey == $key}selected="selected"{/if}{else}{if ($field.Default == $key) || $option.Default }selected="selected"{/if}{/if}>{$lang[$option.pName]}</option>
					{/foreach}
				</select>
			{elseif $field.Type == 'checkbox'}
				{assign var='fDefault' value=$field.Default}
				<input type="hidden" name="account[{$field.Key}][0]" value="0" />
				<table>
				<tr>
				{foreach from=$field.Values item='option' key='key' name='checkboxF'}
					<td {if $smarty.foreach.checkboxF.total > 5}style="width: 33%"{/if}>
						<input type="checkbox" id="{$field.Key}_{$key}" value="{$key}" {if is_array($fVal.$fKey)}{foreach from=$fVal.$fKey item='chVals'}{if $chVals == $key}checked{/if}{/foreach}{else}{foreach from=$field.Default item='chDef'}{if $chDef == $key}checked{/if}{/foreach}{/if} name="account[{$field.Key}][{$key}]" /> <label for="{$field.Key}_{$key}" class="fLable">{$option.name}</label><br>
					</td>
					{if $smarty.foreach.checkboxF.iteration%3 == 0}
					</tr>
					<tr>
					{/if}
				{/foreach}
				</tr>
				</table>
			{elseif $field.Type == 'radio'}
				<input type="hidden" value="0" name="account[{$field.Key}]" />
				<table>
				<tr>
				{foreach from=$field.Values item='option' key='key' name='radioF'}
					<td {if $smarty.foreach.radioF.total > 5}style="width: 33%"{/if}>
						<input type="radio" id="{$field.Key}_{$key}" value="{$key}" name="account[{$field.Key}]" {if $fVal.$fKey}{if $fVal.$fKey == $key}checked{/if}{else}{if $field.Default == $key}checked{/if}{/if} /> <label for="{$field.Key}_{$key}" class="fLable">{$option.name}</label>
					</td>
					{if $smarty.foreach.radioF.iteration%3 == 0}
					</tr>
					<tr>
					{/if}
				{/foreach}
				</tr>
				</table>
			{elseif $field.Type == 'file' || $field.Type == 'image'}
				{assign var='field_type' value=$field.Default}

				{if $fVal.$fKey}
					<div id="{$field.Key}_file">
						{if $field.Type == 'file'}
							<a href="{$smarty.const.RL_URL_HOME}files/{$fVal.$fKey}">{$lang.download}</a>
							|
							<a id="delete_{$field.Key}" href="javascript:void(0)">{$lang.delete}</a>
						{else}
							<div class="relative fleft">
								<img class="thumbnail" title="{$field.name}" alt="{$field.name}" src="{$smarty.const.RL_URL_HOME}files/{$fVal.$fKey}" />
								<img id="delete_{$field.Key}" class="delete" style="display: block;" src="{$rlTplBase}img/blank.gif" alt="" title="{$lang.delete}" />
							</div>
							<div class="clear"></div>
						{/if}
						
						<script type="text/javascript">//<![CDATA[
						{literal}
						
						$(document).ready(function(){
							$('#delete_{/literal}{$field.Key}{literal}').flModal({
								{/literal}
								caption: lang['warning'],
								content: '{$lang.delete_confirm}',
								prompt: "xajax_delAccountFile('{$field.Key}', '{$fVal.$fKey}', '{$field.Key}_file')",
								width: 'auto',
								height: 'auto'
								{literal}
							});
						});
						
						{/literal}
						//]]>
						</script>
					</div>
				{/if}
				
				<input type="hidden" name="account[{$field.Key}]" value="{$fVal.$fKey}" />
				<input class="file" type="file" name="{$field.Key}" />{if $field.Type == 'file' && !empty($field.Default)}<span class="grey_small"> <em>{$l_file_types.$field_type.name} (.{$l_file_types.$field_type.ext|replace:',':', .'})</em></span>{/if}
			{elseif $field.Type == 'accept'}
				<textarea style="width: 80%;" rows="6" readonly class="text" name="{$field.Key}">{$field.default}</textarea><br />
				<input type="hidden" name="account[{$field.Key}]" value="no" />
				<input type="checkbox" id="{$field.Key}" name="account[{$field.Key}]" value="yes" /> <label for="{$field.Key}" class="fLable">{$lang.accept}</label>
				{if $field.Required}
					<span class="red">*</span>
				{/if}
			{/if}
			
			{if !empty($field.description)}
				<img class="qtip" alt="" title="{$field.description}" id="fd_{$field.Key}" src="{$rlTplBase}img/blank.gif" />
			{/if}
		</td>
	</tr>

{/foreach}

<!-- my profile fields end -->